-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: webxdc notify & privacy preserving selfAddr #90
Conversation
src-docs/spec/sendUpdate.md
Outdated
@@ -17,6 +17,9 @@ Send an update to all peers. | |||
Do not add linebreaks; implementations will truncate the text at about 50 characters or less. | |||
If there are series of info messages, older ones may be dropped. | |||
use this option sparingly to not spam the chat. | |||
- `update.notify`: optional array of [user addresses](./selfAddr_and_selfName.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to increase the usefulness of this API, would be nice if dev could pass update.notify=["all"]
to avoid having to collect user IDs before being able to notify, for example a calendar app, it is good that events cause notification without the need of every user opening the app first
src-docs/spec/setSystemListener.md
Outdated
@@ -0,0 +1,42 @@ | |||
# setSystemListener |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meta: this whole API looks a bit unnecessary, the common way to handle deep-linking in the web, and what most web apps support and web devs are used to is #hash
in the URL which the web already provides APIs for accessing and parsing, and some frameworks like React with URL routing system would support and work out of the box,
on sending the update with deep-link the dev could set a update.link="#fragment"
then all what the webview needs to do is to set the url to baseUrl+"#fragment" no yet another event listener, state and API to learn
this would be much easier to implement for developers, for example, to jump to a section in the HTML document when clicking the notification would require ZERO Javascript for the developer as the feature to jump to section/element ID via hash works out of the box in the web
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you inform the app of multiple clicks (i.e. on desktop where a webxdc app runs concurrently)?
Also, if you can provide some concrete APIs for #hash
in a web app, that would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you inform the app of multiple clicks (i.e. on desktop where a webxdc app runs concurrently)?
this works the same as it is today in web APIs, you just open the link, if the app is already in that subpage/link nothing needs to be done
Also, if you can provide some concrete APIs for
#hash
in a web app, that would be nice.
it is used already by apps like the public bot index, see url: https://deltachat-bot.github.io/public-bots/#/home
in that app there is a single page "#/home" but if an about page etc. is added or a category "games" to a xdc store app, etc. user could then open that link/section directly, also it is not only about fragments, that are relative links and would work for subpages ex. update.link="./scoreboard" to open a dedicated scoreboard page, which is useful for simpler apps that don't use #fragment
routing like react et al.
basically real deep-linking, just linking to inside an app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that app there is a single page "#/home" but if an about page etc. is added or a category "games" to a xdc store app, etc. user could then open that link/section directly, also it is not only about fragments, that are relative links and would work for subpages ex. update.link="./scoreboard" to open a dedicated scoreboard page, which is useful for simpler apps that don't use
#fragment
routing like react et al.
Are you saying that the webxdc app should be reloaded on click, but with a different path or fragment?
Is this easy to do on Android (and other platforms)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling https://developer.android.com/reference/android/webkit/WebView#loadUrl(java.lang.String) or similar API should be possible on any platform.
Needs testing whether it results in full reload and losing everything if you only change the fragment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you are talking about window.location.hash
-- and if a user clicks an info message, then we reset that hash? Would the running web app be able to notice that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this. On iOS if you just change the hash part of a URL a webview does not reload.
Would the running web app be able to notice [the hash change]?
Yep: https://developer.mozilla.org/en-US/docs/Web/API/Window/hashchange_event
this PR adds support for the property `update.notify` to notify about changes in `update.info` or `update.summary`. the property can be set to an array of addresses [^1] core emits then the event `IncomingWebxdcNotify`, resulting in all UIs to display a system notification, maybe even via PUSH. for using the existing `update.info` and `update.summary`: the message is no secret and should be visible to all group members as usual, to not break the UX of having same group messages on all devices of all users - as known already from the normal messages. also, that way, there is no question what happens if user have disabled notifications as the change is presented in the chat as well doc counterpart at webxdc/website#90 closes #6217 [^1]: addresses come in either via the payload as currently or as an explicit sender in the future - this does not affect this PR. same for translations, see discussions at #6217 and #6097 --------- Co-authored-by: adb <asieldbenitez@gmail.com> Co-authored-by: l <link2xt@testrun.org>
I removed setSystemEventListener, and added an "update.href" attribute to allow a receiver to directly navigate the webxdc app to this href. |
also refined "selfAddr" and "selfName", and added an example using them together with notify. |
add `update.href` property option to update objects send via `Context::send_webxdc_status_update()`. when set together with `update.info`, UI can implement the info message as a link that is passed to the webxdc via `window.location.href`. for that purpose, UI will read the link back from `Message::get_webxdc_href()`. Practically, this allows e.g. an calendar.xdc to emits clickable update messages opening the calendar at the correct date. closes #6219 documentation at webxdc/website#90
a2d69ca
to
bf284a1
Compare
The new |
notify is for displaying a user-visible notification on the phone of (selected) receiving users . |
…avoids snake_case and camelCase confusion :)
Co-authored-by: WofWca <wofwca@protonmail.com>
…o a dictionary and introduce a catch-all "*" key. this commit also fixes the example which is maybe a bit large now and should rather be a pointer to some actual little pseudo-chat app.
f4c04db
to
8f23e64
Compare
src-docs/spec/sendUpdate.md
Outdated
|
||
- `update.href`: optional string that can be passed as the navigation | ||
location to the webxdc app. | ||
If specified the string must start with `#` and can not contain any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this restricts it too much and potentially make it hard for single-page apps with hash routers that want to use query part for a dialog while the hash is used for pages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think with some examples it is good enough to avoid confusion or force to always declare the path: index.html#fragment instead of allowing sending #fragment only
8f23e64
to
33fa73a
Compare
src-docs/spec/sendUpdate.md
Outdated
- `update.href`: optional string that can be passed as the navigation | ||
location to the webxdc app. | ||
For now, only hash or fragment references are allowed. | ||
Strings must start with `#` and can not contain any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this must start with index.html#
, see deltachat/deltachat-ios#2412 (comment)
0d93080
to
d17d89b
Compare
src-docs/spec/sendUpdate.md
Outdated
|
||
- `update.info`: optional, short, informational message that will be added to the chat, | ||
e.g. "Alice voted" or "Bob scored 123 in MyGame". | ||
Do not add linebreaks; implementations will truncate the text at about 50 characters or less. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw "50 character or less" for info message sounds super restrictive, some users's display name alone (ex. name and lastname) will take up most of that
Co-authored-by: l <link2xt@testrun.org>
Co-authored-by: l <link2xt@testrun.org>
Co-authored-by: l <link2xt@testrun.org>
Add API for notifications and refined `selfAddr` and based on discussions with r10s, adb, hocuri, link2xt and others.
this PR is the documentation part of the M2/M3 tasks from https://github.com/orgs/deltachat/projects/77 , currently about notify / deeplinks (click system events)
closes #89